import React, { Component } from 'react'
import {NavLink} from 'react-router-dom'

export default class My extends Component {
    render() {
        let curUser = localStorage.getItem('username') || '';
        return (
            <div>
                <div className="top">
                    <div style={{display:curUser?'none':'block'}}>
                        <NavLink to="/login">登录</NavLink>
                        <NavLink to="/registry">注册</NavLink>
                    </div>
                    <div style={{display:curUser?'block':'none'}}>
                        {curUser}
                    </div>
                </div>
                <div className="link">
                    <button>我参与的投票</button>
                    <button>我创建的投票</button>
                    <NavLink to="/createVote">创建投票</NavLink>
                </div>
            </div>
        )
    }
}
